package com.ruoyi.web.controller.system;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.Student8;
import com.ruoyi.system.service.IStudent8Service;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 学生表8Controller
 * 
 * @author ruoyi
 * @date 2025-02-13
 */
@RestController
@RequestMapping("/system/student8")
public class Student8Controller extends BaseController
{
    @Autowired
    private IStudent8Service student8Service;

    /**
     * 查询学生表8列表
     */
    @PreAuthorize("@ss.hasPermi('system:student8:list')")
    @GetMapping("/list")
    public TableDataInfo list(Student8 student8)
    {
        startPage();
        List<Student8> list = student8Service.selectStudent8List(student8);
        return getDataTable(list);
    }

    /**
     * 导出学生表8列表
     */
    @PreAuthorize("@ss.hasPermi('system:student8:export')")
    @Log(title = "学生表8", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, Student8 student8)
    {
        List<Student8> list = student8Service.selectStudent8List(student8);
        ExcelUtil<Student8> util = new ExcelUtil<Student8>(Student8.class);
        util.exportExcel(response, list, "学生表8数据");
    }

    /**
     * 获取学生表8详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:student8:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(student8Service.selectStudent8ById(id));
    }

    /**
     * 新增学生表8
     */
    @PreAuthorize("@ss.hasPermi('system:student8:add')")
    @Log(title = "学生表8", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody Student8 student8)
    {
        return toAjax(student8Service.insertStudent8(student8));
    }

    /**
     * 修改学生表8
     */
    @PreAuthorize("@ss.hasPermi('system:student8:edit')")
    @Log(title = "学生表8", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody Student8 student8)
    {
        return toAjax(student8Service.updateStudent8(student8));
    }

    /**
     * 删除学生表8
     */
    @PreAuthorize("@ss.hasPermi('system:student8:remove')")
    @Log(title = "学生表8", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(student8Service.deleteStudent8ByIds(ids));
    }
}
